#include "mlPoint.h"
#include <math.h>
#include <stdio.h>
#include <string.h>

const float
mlPointZero[3] = { 0.0f, 0.0f, 0.0f };

void
mlPointPrint(const float *a)
{
	printf("(%f, %f, %f)\n", a[0], a[1], a[2]);
}

void
mlPointCopy(const float *a, float *result)
{
	memcpy(result, a, 3 * sizeof(float));
}

void
mlPointLoad(float *a, float x, float y, float z)
{
	a[0] = x; a[1] = y; a[2] = z;
}

void
mlPointLoadZero(float *a)
{
	mlPointLoad(a, 0.0f, 0.0f, 0.0f);
}

void
mlPointAddTo(const float *a, const float *b, float *result)
{
	unsigned int i;

	for(i = 0; i < 3; i++)
		result[i] = a[i] + b[i];
}

void
mlPointAdd(float *a, const float *b)
{
	unsigned int i;

	for(i = 0; i < 3; i++)
		a[i] += b[i];
}

void
mlPointSubTo(const float *a, const float *b, float *result)
{
	unsigned int i;

	for(i = 0; i < 3; i++)
		result[i] = a[i] - b[i];
}

void
mlPointSub(float *a, const float *b)
{
	unsigned int i;

	for(i = 0; i < 3; i++)
		a[i] -= b[i];
}
